package com.qq.filter;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.*;

@WebListener
public class Listener02 implements HttpSessionListener {

    @Override
    public void sessionCreated(HttpSessionEvent httpSessionEvent) {
        System.out.println("我被创建了");
        HttpSession session = httpSessionEvent.getSession();
        //设置销毁时间围为10秒
        //session.setMaxInactiveInterval(0);
        //让session失效
        //session.invalidate();
        String  id = session.getId();
        System.out.println("创建sessionID="+id);
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
        System.out.println("销毁sessionID=????");

    }
}
